热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

CSS|网格自动行属性

CSS|网格-自动行属性原文:https://www.geek

CSS |网格-自动行属性

原文:https://www.geeksforgeeks.org/css-grid-auto-rows-property/

CSS 中的 grid-auto-rows 属性用于指定隐式生成的网格容器的行的大小。

语法:

grid-auto-rows: auto|max-content|min-content|length|
percentage|minmax(min, max)|initial|inherit;

属性值:


  • auto: This is the default value. The size is determined implicitly according to the size of the container.

    示例:

    ```html
     
     
        

     
             
                CSS grid-auto-rows Property 
             

     
                .main { 
                    display: grid; 
                    grid-template-areas: "a a"; 
                    grid-gap: 20px; 
                    padding: 30px; 
                    background-color: green;
                    grid-auto-rows:  auto;


                .GFG { 
                    text-align: center; 
                    font-size: 35px; 
                    background-color: white; 
                    padding: 20px 0; 
                } 
             
         

     
            
     
                
    1
     
                
    2
     
                
    3
     
                
    4
     
                
    5
     
            
     
         
     
    ```

    输出:


  • length: It is used to set grid-auto-rows property to given length. The length value can not be negative.

    示例:

    ```html
     
     
        

     
             
                CSS grid-auto-rows Property 
             

     
                .main { 
                    display: grid; 
                    grid-template-areas: "a a"; 
                    grid-gap: 20px; 
                    padding: 30px; 
                    background-color: green;
                    grid-auto-rows: 3.5cm;


                .GFG { 
                    text-align: center; 
                    font-size: 35px; 
                    background-color: white; 
                    padding: 20px 0; 
                } 
             
         

     
            
     
                
    1
     
                
    2
     
                
    3
     
                
    4
     
                
    5
     
            
     
         
     
    ```

    输出:


  • percentage: It sets the grid-auto-rows property to percentage value.

    示例:

    ```html
     
     
        

     
             
                CSS grid-auto-rows Property 
             

     
                .main { 
                    display: grid; 
                    grid-template-areas: "a a"; 
                    grid-gap: 20px; 
                    padding: 30px; 
                    background-color: green;
                    grid-auto-rows:  30%;


                .GFG { 
                    text-align: center; 
                    font-size: 35px; 
                    background-color: white; 
                    padding: 20px 0; 
                } 
             
         

     
            
     
                
    1
     
                
    2
     
                
    3
     
                
    4
     
                
    5
     
            
     
         
     
    ```

    输出:


  • 最大含量:根据容器中最大的物品指定尺寸。


  • 最小含量:根据容器中最小的物品指定尺寸。

  • minmax(min, max): Specifies the size in the range of [min, max]. greater than or equal to min and less than or equal to max.

    示例:

    ```html
     
     
        

     
             
                CSS grid-auto-rows Property 
             

     
                .main { 
                    display: grid; 
                    grid-template-areas: "a a"; 
                    grid-gap: 20px; 
                    padding: 30px; 
                    background-color: green;
                    grid-auto-rows:  minmax(100px, 3.5cm);


                .GFG { 
                    text-align: center; 
                    font-size: 35px; 
                    background-color: white; 
                    padding: 20px 0; 
                } 
             
         

     
            
     
                
    1
     
                
    2
     
                
    3
     
                
    4
     
                
    5
     
            
     
         
     
    ```

    输出:


  • initial: Initializes the value with its default value.

    示例:

    ```html
     
     
        

     
             
                CSS grid-auto-rows Property 
             

     
                .main { 
                    display: grid; 
                    grid-template-areas: "a a"; 
                    grid-gap: 20px; 
                    padding: 30px; 
                    background-color: green;
                    grid-auto-rows: initial;


                .GFG { 
                    text-align: center; 
                    font-size: 35px; 
                    background-color: white; 
                    padding: 20px 0; 
                } 
             
         

     
            
     
                
    1
     
                
    2
     
                
    3
     
                
    4
     
                
    5
     
            
     
         
     
    ```

    输出:


  • inherit: Inherits the value from its parent element.

    示例:

    ```html
                             
     
        

     
             
                CSS grid-auto-rows Property 
             

     
                .container {
                    grid-auto-rows: 80px;
                }
                .main { 
                    display: grid; 
                    grid-template-areas: "a a"; 
                    grid-gap: 20px; 
                    padding: 30px; 
                    background-color: green;
                    grid-auto-rows: inherit;
                } 
                .GFG { 
                    text-align: center; 
                    font-size: 35px; 
                    background-color: white; 
                    padding: 20px 0; 
                } 
             
         

     
            

                

                    
    1
     
                    
    2
     
                    
    3
     
                    
    4
     
                    
    5
     
                
     
            
     
         
                        
    ```

    输出:


支持的浏览器:网格自动排属性支持的浏览器如下:


  • Chrome 57.0

  • Edge 16.0

  • Firefox 52.0

  • Safari 10.0

  • Opera 44.0


推荐阅读
  • CSS|网格-行-结束属性原文:https://www.gee ... [详细]
  • Voicewo在线语音识别转换jQuery插件的特点和示例
    本文介绍了一款名为Voicewo的在线语音识别转换jQuery插件,该插件具有快速、架构、风格、扩展和兼容等特点,适合在互联网应用中使用。同时还提供了一个快速示例供开发人员参考。 ... [详细]
  • 本文整理了常用的CSS属性及用法,包括背景属性、边框属性、尺寸属性、可伸缩框属性、字体属性和文本属性等,方便开发者查阅和使用。 ... [详细]
  • css元素可拖动,如何使用CSS禁止元素拖拽?
    一、用户行为三剑客以下3个CSS属性:user-select属性可以设置是否允许用户选择页面中的图文内容;user-modify属性可以设置是否允许输入 ... [详细]
  • css div中文字位置_超赞的 CSS 阴影技巧与细节
    本文的题目是CSS阴影技巧与细节。CSS阴影,却不一定是box-shadow与filter:drop-shadow,为啥?因为使用其他属性 ... [详细]
  • Python瓦片图下载、合并、绘图、标记的代码示例
    本文提供了Python瓦片图下载、合并、绘图、标记的代码示例,包括下载代码、多线程下载、图像处理等功能。通过参考geoserver,使用PIL、cv2、numpy、gdal、osr等库实现了瓦片图的下载、合并、绘图和标记功能。代码示例详细介绍了各个功能的实现方法,供读者参考使用。 ... [详细]
  • 如何在HTML中获取鼠标的当前位置
    本文介绍了在HTML中获取鼠标当前位置的三种方法,分别是相对于屏幕的位置、相对于窗口的位置以及考虑了页面滚动因素的位置。通过这些方法可以准确获取鼠标的坐标信息。 ... [详细]
  • 本文介绍了响应式页面的概念和实现方式,包括针对不同终端制作特定页面和制作一个页面适应不同终端的显示。分析了两种实现方式的优缺点,提出了选择方案的建议。同时,对于响应式页面的需求和背景进行了讨论,解释了为什么需要响应式页面。 ... [详细]
  • ECMA262规定typeof操作符的返回值和instanceof的使用方法
    本文介绍了ECMA262规定的typeof操作符对不同类型的变量的返回值,以及instanceof操作符的使用方法。同时还提到了在不同浏览器中对正则表达式应用typeof操作符的返回值的差异。 ... [详细]
  • 本文介绍了贝叶斯垃圾邮件分类的机器学习代码,代码来源于https://www.cnblogs.com/huangyc/p/10327209.html,并对代码进行了简介。朴素贝叶斯分类器训练函数包括求p(Ci)和基于词汇表的p(w|Ci)。 ... [详细]
  • 如何压缩网站页面以减少页面加载时间
    本文介绍了影响网站打开时间的两个因素,即网页加载速度和网站页面大小。重点讲解了如何通过压缩网站页面来减少页面加载时间。具体包括图片压缩、Javascript压缩、CSS压缩和HTML压缩等方法,并推荐了相应的压缩工具。此外,还提到了一款Google Chrome插件——网页加载速度分析工具Speed Tracer。 ... [详细]
  • 本文由编程笔记#小编为大家整理,主要介绍了markdown[软件代理设置]相关的知识,希望对你有一定的参考价值。 ... [详细]
  • 由于同源策略的限制,满足同源的脚本才可以获取资源。虽然这样有助于保障网络安全,但另一方面也限制了资源的使用。那么如何实现跨域呢,以下是实现跨域的一些方法。 ... [详细]
  • css,背景,位置,y,background, ... [详细]
  • 《Axure新技能:自适应手机屏幕大小》相信不少人都已经看过,并对设置方法已经很熟悉了,但该教程只能适应iphone6的屏幕尺寸的比例&# ... [详细]
author-avatar
文竹a
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有